package ${cfg.Controller};


import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import ${cfg.Req}.${entity}Req;
import ${cfg.Resp}.${entity}Resp;
import ${cfg.Service}.${entity}Service;

/**
* ${table.comment!} 前端控制器
*
* @author ${author}
* @since ${cfg.time}
*/
@RestController
@RequestMapping("<#if package.ModuleName??>/${package.ModuleName}</#if>/<#if controllerMappingHyphenStyle??>${controllerMappingHyphen}<#else>${table.entityPath}</#if>")
public class ${table.controllerName} {
@Autowired
${entity}Service service;

@ApiOperation("新增")
@PostMapping("/create")
void create(@Validated @RequestBody ${entity}Req req) {
service.create(req);
}

@ApiOperation("编辑")
@PostMapping("/update")
void update(@Validated @RequestBody ${entity}Req req) {
service.update(req);
}

@ApiOperation("删除")
@GetMapping("/del")
void del(@PathVariable("id") Long id) {
service.del(id);
}


@ApiOperation("分页查询")
@GetMapping("/qry")
IPage
<${entity}Resp> qry(@Validated @RequestBody ${entity}Req req) {
    return service.qry(req);
    }

    @ApiOperation("查询详情")
    @GetMapping("/getDetail")
    ${entity}Resp getDetail(@PathVariable("id") Long id) {
    return service.getDetail(id);
    }
    }

